package com.csjbot.blackgaga.localbean;


import com.baidu.robot.thirdparty.google.reflect.TypeToken;
import com.csjbot.blackgaga.model.tcp.bean.Position;
import com.csjbot.blackgaga.util.GsonUtils;
import com.csjbot.blackgaga.util.SharedKey;
import com.csjbot.blackgaga.util.SharedPreUtil;

import java.io.Serializable;
import java.util.List;

/**
 *
 * Created by jingwc on 2017/9/21.
 */

public class NaviBean implements Serializable {
    public String id;

    protected Position pos;

    protected String name;

    protected String description;

    protected String musicPath;

    protected String descInRunning;

    protected boolean isOpenMusic = false;

    protected boolean isOpenSpeak = false;

    protected float translationX;

    protected float translationY;

    public int left, right, bottom, top;

    public float getTranslationX() {
        return translationX;
    }

    public void setTranslationX(float translationX) {
        this.translationX = translationX;
    }

    public float getTranslationY() {
        return translationY;
    }

    public void setTranslationY(float translationY) {
        this.translationY = translationY;
    }

    public Position getPos() {
        return pos;
    }

    public void setPos(Position pos) {
        this.pos = pos;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String toJson() {
        return pos.toJson();
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public void setDescInRunning(String descInRunning) {
        this.descInRunning = descInRunning;
    }

    public String getDescInRunning() {
        return descInRunning;
    }

    public void setMusicPath(String musicPath) {
        this.musicPath = musicPath;
    }

    public String getMusicPath() {
        return musicPath;
    }

    public boolean isOpenMusic() {
        return isOpenMusic;
    }

    public boolean isOpenSpeak(){
        return isOpenSpeak;
    }

    public void setOpenMusic(boolean openMusic) {
        isOpenMusic = openMusic;
    }

    public void setOpenSpeak(boolean openSpeak) {
        isOpenSpeak = openSpeak;
    }

    public static List<NaviBean> getNaviBeanList() {
        String json = SharedPreUtil.getString(SharedKey.GUIDE_NAME, SharedKey.GUIDE_KEY);
        List<NaviBean> list = GsonUtils.jsonToObject(json, new TypeToken<List<NaviBean>>() {
        }.getType());

        if(list == null || list.size() == 0) return null;

        return list;
    }
}
